 <meta charset="utf-8">
 <div class="box" id="biz_authApp_conatainer">
            <div class="box-header with-border">
               <form id="searchForm" role="form" class="form-inline">
                    <div class="form-group">
                         <label>应用编号</label>
                         <input name="appkey" type="text" placeholder="" class="form-control">
                    </div>
                     <div class="form-group">
                    <label>应用名称</label>
                      <input name="name" type="text" placeholder="" class="form-control">    
                    </div>
					<button type="button" class="btn btn-info pull-right m-t-n-xs" v-kperms="{perm:'authApp:loadAuthAppList'}"  v-on:click="search" ><strong>查询</strong></button>
                </form>
            </div>
 <div class="box-body">
 	                           <div class="btn-group " id="authAppTableToolbar" role="group">
                                    <button type="button" v-kperms="{perm:'authApp:addAuthApp'}"  class="btn btn-default" v-on:click="add">
                                        <i class="glyphicon glyphicon-plus" aria-hidden="true"></i> 添加
                                    </button>
                                    
                                     <button type="button"  v-kperms="{perm:'authApp:updateAuthApp'}" class="btn btn-default" v-on:click="edit">
                                        <i class="glyphicon glyphicon-pencil" aria-hidden="true"></i> 修改
                                    </button>
                                  
                                    <button type="button"  v-kperms="{perm:'authApp:deletAuthApp'}" class="btn btn-default" v-on:click="deletex">
                                        <i class="glyphicon glyphicon-trash" aria-hidden="true"></i> 删除
                                    </button>
                                     <button type="button"  v-kperms="{perm:'authApp:setAuthAppEnabled'}" class="btn btn-default" v-on:click="setEnable">
                                        <i class="glyphicon glyphicon-ok" aria-hidden="true"></i> 启用
                                    </button>
                                     <button type="button"  v-kperms="{perm:'authApp:setAuthAppEnabled'}" class="btn btn-default" v-on:click="setDisable">
                                        <i class="glyphicon glyphicon-remove" aria-hidden="true"></i> 禁用
                                    </button>
                           </div>
           <table id="authAppBt" data-mobile-responsive="true" ></table>
 </div> 
</div>
<script>

new Vue({  
	  el: '#biz_authApp_conatainer',  
	  data: {},
	  mounted:function(){
		  this.initTable();
	  },
      methods: {
    	  initTable:function(){
    		  let columns=[
    				{checkbox:true},
    				{field:'appkey',title:'应用编号',width:100,sortable:true},
    				{field:'name',title:'应用名称',width:160},
    				{field:'appDomain',title:'域名',width:120},
    				{field:'enabled',title:'状态',width:60,formatter:zfesUtil.formatEnabled},
    				{field:'remark',title:'备注',width:60}];
    		  let url="auth/authApp/loadAuthAppList";
    		  zfesBstable.laodTable($("#authAppBt"),$("#searchForm"),$("#authAppTableToolbar"),url,columns);
    	  },
    	  search:function(){
    		  zfesBstable.reload($("#authAppBt")); 
    	  },
    	  refresh:function(){
    		  zfesBstable.refresh($("#authAppBt"));
    	  },
    	  add:function(){
    		  let　_this=this;
    		  let url="/view/auth/authApp/authApp.add.html";
    		  zfesLayerEditDg.open(url,{},"APP编辑",460,function(){_this.refresh();});
    	  },
    	  edit:function(){
    		  if(zfesBstable.isOneRow($("#authAppBt"))){
    			  let　_this=this;
    			  let id=zfesBstable.getRowId($("#authAppBt"));
    			  let url="/view/auth/authApp/authApp.edit.html";
    			  zfesLayerEditDg.open(url,{"id":id},"APP编辑",600,function(){_this.refresh();}); 
    		 }
    	  },
    	  setEnable:function(){
    		  if(zfesBstable.isSelectedRow($("#authAppBt"))){
    			  let ids=zfesBstable.getRowIds($("#authAppBt"));
    			  let　_this=this;
    				 alertSwal.confirm("启用","是否执行该操作",function(){
						    let ajaxUrl = "auth/authApp/setAuthAppEnabled";
						    zfesAjax.ajaxTodo(ajaxUrl, { "ids" : ids,"enabled":true}, function(data) {
								alertSwal.successText(data.message);
								_this.refresh();
							});
						});
    		  }
    	  },
    	  setDisable:function(){
    		  if(zfesBstable.isSelectedRow($("#authAppBt"))){
    			  let ids=zfesBstable.getRowIds($("#authAppBt"));
    			  let　_this=this;
    				 alertSwal.confirm("禁用","是否执行该操作",function(){
						    let ajaxUrl = "auth/authApp/setAuthAppEnabled";
						    zfesAjax.ajaxTodo(ajaxUrl, { "ids" : ids,"enabled":false}, function(data) {
								alertSwal.successText(data.message);
								_this.refresh();
						});
    		  		});
    		  }
    	  },
    	  deletex:function(){
    			if(zfesBstable.isOneRow($("#authAppBt"))){
    				  let　_this=this;
    					var id=zfesBstable.getRowId($("#authAppBt"));
    					 alertSwal.confirm("删除","是否删除该应用",function(){
    						  
    						    let ajaxUrl = "auth/authApp/deletAuthApp";
    							zfesAjax.ajaxTodo(ajaxUrl, { "id" : id}, function(data) {
    								alertSwal.successText(data.message);
    								_this.refresh();
    							},function(data){
    								
    							}); 
    				});
    			}
    				
    	  }
     	
     }

});
</script>
